﻿using System;

namespace CSEngine
{
    public interface AI
    {
        Move GetNextMove(object sender, PlayerTurnArgs e);
    }

    public sealed class EasyAI : AI
    {
        private static Random rand = new Random();

        public Move GetNextMove(object sender, PlayerTurnArgs e)
        {
            HexDigit x, y;
            do
            {
                x = (HexDigit)(rand.Next(15) + 1);
                y = (HexDigit)(rand.Next(15) + 1);
            } while (e.Board.GetSpace(x, y).Color != SpaceColor.EMPTY);

            return new Move(x, y);
        }
    }

    public sealed class MediumAI : AI
    {
        public int DEPTH = 2;

        public Move GetNextMove(object sender, PlayerTurnArgs e)
        {
            Minimax minimax = new Minimax(e.Board, e.LastPlayer.Color, DEPTH);

            return minimax.getBestMove(DEPTH);
        }

    }

    public sealed class HardAI : AI
    {
        public int DEPTH = 4;

        public Move GetNextMove(object sender, PlayerTurnArgs e)
        {
            Minimax minimax = new Minimax(e.Board, e.LastPlayer.Color, DEPTH);

            return minimax.getBestMove(DEPTH);
        }

    }

}
